/**
 * Author: runlin.tang
 * Creation Time: 2016-06-29.
 * Description:.���后台绑定数据接口
 */
define(['jquery','../../common/ajax/ajax'],
    function($,ajax) {
        function example(sns,macs){
            var newUrl = serUrl+'/route/binding';
            ajax({
                url:newUrl,
                dataType:interfaces.binding.dataType,
                type:interfaces.binding.type,
                data:JSON.stringify({
                    mac:macs,
                    sn:sns,
                }),
                contentType: 'application/json',
                cache:{
                    use:false,
                    name:'',
                    time:10
                },
                isOk:function(data){
                    var datas = '';
                    if(useNetData){
                        datas = data;
                    }else{
                        datas = data.binding;
                    }
                    if(datas.code==00000){
                        $(".ly-tip").remove();
                        var html = '<div class="ly-tip ok-tip"><i></i><span>绑定成功，请点击下一步按钮！</span></div><div class="com_btn"><a href="javascript:;" class="success-binding">下一步</a></div>';
                        $(".com_btn").remove();
                        $(".webApp-content").append(html);
                    }else{
                        if($(".webApp-content .fail-tip").length<1){
                            var html = '<div class="ly-tip fail-tip"><i></i><span>绑定失败，'+datas.data+'，请重新绑定</span></div>';
                            $(".com_btn").before(html);
                        }
                    }
                }
            });
        }
        return example;
    });